USE [GHBank]
GO

/****** Object:  DatabaseRole [db_GHBank]    Script Date: 12/13/2010 13:48:33 ******/
CREATE ROLE [db_GHBank] AUTHORIZATION [dbo]
GO

use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetDepartmentByPrivilege] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Update_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_stp_sub_menu] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter_stp_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[stp_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[stp_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[stp_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[stp_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_stp_auth_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter_stp_auth_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetListAuthenGroup] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[GetStaffNameByStaffCode] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetMainSystemIdForRemoving] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetBreadCrumb] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter_stp_auth_department_for_add_edit] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_group1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetHirachyPrefix2] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_stp_auth_group] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetSTPDepartmentHirachy] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_group2] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[stp_main_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[stp_main_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[stp_main_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[stp_main_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[fn_GetRootHirachy] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_group] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Report_Master_Department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Report_Group_User] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_department1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetDepartmentByPrivilege1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetUserShowTime] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[fn_GetParentName] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter_stp_auth_group] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_stp_main_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetListStaff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_UserPrivilege] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetDepartmentHirachyByMainSystemCode] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_UpdatePassword] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetDepartmentByLevel] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_stp_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Save_Staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetOnlineStaff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetDepartmentHirachy] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_log_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_InsertOnlineStaff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_staff_report] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_stp_auth_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetAuthStaffObjects] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetMainSystemFoldersByStaffCode] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_master_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_RaiseError] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_staff2] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_get] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter_stp_auth_staff2] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetAuditor] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetMenuSystem] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[UFN_Split] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_group_user] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetSystemAndMenuAndSubListByUserPrivilege] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_department1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetDepartmentAsBlankHirachyByDepartmentCode] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetDepartmentByUserType2] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_sub_menu] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_UpdateOnlineStaff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetHeadDepartmentByMasterDepartmentLevel] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_group_user3] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetAuthGroupObjects] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[stp_auth_group] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[stp_auth_group] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[stp_auth_group] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[stp_auth_group] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetUserDetailByStaffCode] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_master_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetSystemAndMenuListByUserPrivilege] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetStaffForLoginPage] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter2_stp_auth_department1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetListAuthenStaff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter_stp_auth_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetSystemListByUserPrivilege] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_group_report] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_master_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[log_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[log_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[log_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[log_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_DeleteMasterDepartment] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[log_password] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[log_password] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[log_password] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[log_password] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[fn_GetAuthen] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter_group_user] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetDepartmentAsHirachyByDepartmentCode] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[group_user_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[group_user_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[group_user_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[group_user_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetAuthenStaff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetMenuByPriviledge] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetHirachyPrefix] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetAuthenDepartment] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[stp_auth_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[stp_auth_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[stp_auth_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[stp_auth_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_master_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetDepartmentByUserType1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_staff_report2] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[master_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[master_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[master_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[master_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_menu_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[staff_online] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[staff_online] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[staff_online] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[staff_online] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[UFN_GetTableInformation] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[UFN_GetTableInformation] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[UFN_GetTableInformation] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[UFN_GetTableInformation] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[master_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[master_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[master_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[master_type] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GenericDelete] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_SaveMasterDepartment] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter2_stp_auth_department] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_department_report] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[stp_menu_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[stp_menu_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[stp_menu_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[stp_menu_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[stp_auth_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[stp_auth_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[stp_auth_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[stp_auth_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_group_user1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetMenuSystemByUserPrivilege] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_log_system_report] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_stp_menu_system] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetAuthenGroup] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetDepartmentDeepByDepartmentCode] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_staff1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[group_user] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[group_user] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[group_user] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[group_user] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[fnIter_intlist_to_table] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_auth_staff] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_GetMenu2] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_staff_report1] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetStatusLabel] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT DELETE ON [dbo].[stp_sub_menu] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT INSERT ON [dbo].[stp_sub_menu] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT SELECT ON [dbo].[stp_sub_menu] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT UPDATE ON [dbo].[stp_sub_menu] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Filter_stp_sub_menu] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_Validate_Delete_group_user] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[UFN_GetDepartmentHirachyByDepartmentCode] TO [db_GHBank]
GO
use [GHBank]
GO
GRANT EXECUTE ON [dbo].[USP_List_stp_main_system] TO [db_GHBank]
GO

/****** Object:  User [GHBank]    Script Date: 12/13/2010 13:54:55 ******/
USE [master]
GO
CREATE LOGIN [GHbank] WITH PASSWORD=N'P@ssw0rd', DEFAULT_DATABASE=[GHBank], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
USE [GHBank]
GO
CREATE USER [GHBank] FOR LOGIN [GHBank] WITH DEFAULT_SCHEMA=[dbo]
GO
USE [GHBank]
GO
EXEC sp_addrolemember N'db_GHBank', N'GHbank'
GO
